<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
	<title>商家管理之增加商家</title>
	<link rel="icon" href="${pageContext.request.contextPath}/static/admin/favicon.ico" type="image/ico">
	<meta name="keywords" content="后台模板,后台管理系统,HTML模板">
	<meta name="description" content="基于Bootstrap的后台管理系统模板">
	<meta name="author" content="www.bootstrapmb.com">
	<link href="${pageContext.request.contextPath}/static/admin/css/bootstrap.min.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/static/admin/css/fonts.css" rel="stylesheet">
	<!--标签插件-->
	<link rel="stylesheet"
		  href="${pageContext.request.contextPath}/static/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
	<link href="${pageContext.request.contextPath}/static/admin/css/style.css" rel="stylesheet">
</head>

<body>
<!--页面主要内容-->
<main class="ftdms-layout-content">

	<div class="container-fluid" style="height: 1200px;">

		<div class="row" style="margin-top:15px;">
			<div class="col-lg-12">
				<div class="card">
					<div class="card-body">

						<form  action="clothingadd.action"
							  method="post" class="row" enctype="multipart/form-data">
							<div class="form-group col-md-12">
								<label >物品图片</label>
								<input type="file" class="form-control" id="file1" name="file1"  />
							</div>

							<div class="form-group col-md-12">
								<label >用户名称</label>
								<select class="form-control" name="uId" >
									<option value="${createUser.uId}">${createUser.uName}</option>
								</select>
							</div>

							<div class="form-group col-md-12">
								<label >用户电话</label>

								<select class="form-control" name="uTel" >
									<option value="${createUser.uTel}">${createUser.uTel}</option>
								</select>
							</div>

							<div class="form-group col-md-12">
								<label>状态名称</label>
								<select class="form-control" name="csId">
									<c:forEach var="clothingstate" items="${clothingstatelist}">
										<option value="${clothingstate.csId}">${clothingstate.clothingStateName}</option>
									</c:forEach>
								</select>
							</div>

							<div class="form-group col-md-12">
								<input type="hidden" id="data">
								<button type="submit"  class="btn btn-primary ajax-post"
										target-form="add-form">确 定
								</button>
								<button type="button" class="btn btn-default"
										onclick="javascript:history.back(-1);return false;">返 回
								</button>
							</div>
						</form>

					</div>
				</div>
			</div>

		</div>

	</div>

</main>
<!--End 页面主要内容-->
</div>
</div>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/bootstrap.js"></script>
<script type="text/javascript"
		src="${pageContext.request.contextPath}/static/admin/js/perfect-scrollbar.min.js"></script>
<!--标签插件-->
<script src="${pageContext.request.contextPath}/static/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/main.min.js"></script>
<script>
	$(function () {
		$('#businessTel').blur(function () {
			var b = $('#businessTel').val();
			console.log(b);
			$.post("${pageContext.request.contextPath}/admin/businesstel.action", {businessTel: b}, function (data) {
				console.log(data)
				var d=$("#data").val(data);
				console.log(d)
				if (data == false) {
					$('#mess').css("color", "green")
					$('#mess').html("该号码可用");
				}
				if (data == true) {
					$('#mess').css("color", "red")
					$('#mess').html("该号码已注册");
				}
			});
		});
	})
	function myfun1() {
		var d = $("#data").val();
		console.log("sadasd"+d);
		var businessName=$('#businessName').val();
		var businessTel=$('#businessTel').val();
		var businessPass=$('#businessPass').val();
		var qbusinessPass=$('#qbusinessPass').val();
		var businessAddress=$('#businessAddress').val();
		if(businessName.trim()==null||businessName.trim()==""){
			alert("商家名称不能为空");
			return;
		}  if(businessTel.trim()==null||businessTel.trim()==""){
			alert("商家电话不能为空");
			return;
		}
		if (businessPass.trim() == null || businessPass.trim() == "") {
			alert("商家密码不能为空");
			return;
		}if (qbusinessPass.trim() !=businessPass.trim()) {
			alert("两次密码不一致");
			return;
		}
		if (businessAddress.trim() == null || businessAddress.trim() == "") {
			alert("商家地址不能为空");
			return;
		}
		if (d == "true") {
			alert("账号存在不能提交");
			return;
		}
		$("#form1").submit();
	}
</script>
</body>

</html>